<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>canvasrect</title>
    <script type="text/javascript">
        window.onload=function () {
            var can=document.getElementById("mycanvas");
            var ocon=can.getContext("2d");
            ocon.fillStyle="#cccccc";
            ocon.fillRect(0,0,200,200);
            ocon.strokeStyle="#ff0000";
            ocon.lineWidth=10;
            ocon.strokeRect(10,10,100,100);
            ocon.fillStyle="#00ff00";
            ocon.fillRect(10,10,100,100);
        }
    </script>
</head>
<body>
<canvas id="mycanvas"></canvas>
</body>
</html>